#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 300005;
int N, D;
int table[MAXN];
void solve();
int main() {
    cin >> N >> D;
    for (int i = 0; i < N; i++)
        cin >> table[i];
    solve();
    return 0;
}

void solve() {
    int res = 0, last_least = 0;
    for (int i = 0; i < N; i++) {
        if (last_least > N - 1) break;
        if (table[i]) last_least = i + D;
        else if (last_least <= i) {
            res++; 
            last_least = i + D;
        }
    }
    cout << res << endl;
}
